package repository

import (
	"github.com/jinzhu/copier"
	"go-ddd/ui/dto"
	"time"
)

type Activity struct {
	Base
	StartAt time.Time
	EndAt   time.Time
	Name    string
}

func (a *Activity) Find(id int) (*Activity, bool) {
	var activity Activity

	notFound := db.Find(&activity, id).RecordNotFound()
	return &activity, notFound
}

func (a *Activity) Transform() *dto.Activity {

	var dto dto.Activity
	_ = copier.Copy(&dto, a)

	return &dto
}
